stage.set_background("winter")
sprite = codesters.Sprite("fox")
sprite.move_down(150)
try:
tval1 = sprite.get_x()
except:
tval1 = "DNE"
try:
tval2 = int(stage.get_wait_time())
except:
tval2 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == 50, "Great Job!")
t1.add_failure(tval1 == 0, "Did you move the sprite to the right?")
t1.add_failure(tval1 == "DNE", "Did you delete the sprite?")
t1.add_failure(tval1 >= 300, "Did you move the sprite off of the stage?")
t1.add_creative(tval1 != 50 and tval1 != 0 and tval1 < 300 and tval1 != "DNE", "That is a good position for the sprite!")
t2 = TestObjective()
t2.add_success(tval2 == 2, "Great Job!")
t2.add_failure(tval2 == 0, "Did you add a wait command?")
t2.add_creative(tval2 != 2 and tval2 != 0, "That is a creative choice!")
tester = TestManager()
tester.add_test_list([t2, t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)